#include <bits/stdc++.h>
#define int long long
using namespace std;

int a[100005];
bool b[100005];
bool cmp(int a, int b)
{
    return a < b;
}

signed main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, ans = 0, maxn = 0, minn = INT_MAX;
    cin >> n;
    int c1 = 0, c2 = 0;
    for (int i = 1;i <= n;i++)
    {
        cin >> a[i];
        if (a[i] == 1) c1++;
        else if (a[i] == 2) c2++;
        maxn = max(maxn, a[i]);
        minn = min(minn, a[i]);
    }

    if (minn == 1 && maxn == 2) 
    {
        if (c1 > c2) ans = n - c2;
        else ans = c2;
        cout << ans << "\n";
        return 0;
    }
    sort(a + 1, a + n + 1,cmp);
    int jsq = 0;
    for (int i = 2;i <= n;i++)
    {
        int j = i - 1;
        while (j-- && b[i] == 0 && j > 0)
        {
            if (a[j] < a[i]) 
            {
                b[j] = 1;
                jsq++;
                j = 0;
            }
        }
    }
    ans = n - jsq;
    cout << ans << "\n";
    return 0;
}